package absolute.zero.utils;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;

public class DateUtils {
	public int intervalDays(String small,String big) throws ParseException{
		Calendar c1 = new  java.util.GregorianCalendar();
		Calendar c2 = new  java.util.GregorianCalendar();
		java.text.SimpleDateFormat s = new java.text.SimpleDateFormat("yyyyMMdd");
		c1.setTime(s.parse(small));
		c1.set(Calendar.HOUR_OF_DAY, 0);
		c1.set(Calendar.MINUTE, 0);
		c1.set(Calendar.SECOND, 0);
		c1.set(Calendar.MILLISECOND, 1);
		
		c1.getTimeInMillis();
		c2.setTime(s.parse(big));
		c2.set(Calendar.HOUR_OF_DAY, 0);
		c2.set(Calendar.MINUTE, 0);
		c2.set(Calendar.SECOND, 0);
		c2.set(Calendar.MILLISECOND, 1);
		return (int)((c2.getTimeInMillis()-c1.getTimeInMillis())/1000/60/60/24);
	} 
}
